use crate::data_structure::my_vec::MyVec;

pub trait ExtendStr {
  fn char_at(&self, byte: usize) -> char;
}

impl ExtendStr for str {
  fn char_at(&self, byte: usize) -> char {
    self[byte..].chars().next().unwrap()
  }
}

pub trait ExtendSlice<T: Clone> {
  fn to_my_vec(&self) -> MyVec<T>;
}

impl<T: Clone> ExtendSlice<T> for [T] {
  fn to_my_vec(&self) -> MyVec<T> {
    let mut v = MyVec::new();
    for i in self {
      v.push((*i).clone());
    }
    v
  }
}
